// 用户相关类型
export interface User {
  id: number;
  username: string;
  email: string;
  role: 'admin' | 'user';
  created: string;
  last_login: string;
}

export interface LoginRequest {
  username: string;
  password: string;
}

export interface LoginResponse {
  code: number;
  message: string;
  data?: {
    token: string;
    user: User;
  };
}

// 工具相关类型
export interface Tool {
  id: number;
  name: string;
  description: string;
  category: string;
  version: string;
  status: 'active' | 'inactive' | 'maintenance';
  url: string;
  config: Record<string, any>;
  created: string;
  updated: string;
}

export interface CreateToolRequest {
  name: string;
  description: string;
  category: string;
  version: string;
  status: 'active' | 'inactive' | 'maintenance';
  url: string;
  config?: Record<string, any>;
}

// 配置相关类型
export interface Config {
  name: string;
  description: string;
  value: any;
  type: 'string' | 'number' | 'boolean' | 'object' | 'array';
  created: string;
  updated: string;
}

export interface CreateConfigRequest {
  name: string;
  description: string;
  value: any;
  type: 'string' | 'number' | 'boolean' | 'object' | 'array';
}

// API响应类型
export interface ApiResponse<T = any> {
  code: number;
  message: string;
  data?: T;
  error?: string;
}

// 通用列表响应
export interface ListResponse<T = any> {
  items: T[];
  total: number;
  page: number;
  pageSize: number;
}

// 分页参数
export interface PaginationParams {
  page?: number;
  pageSize?: number;
  sortBy?: string;
  sortOrder?: 'asc' | 'desc';
}

// 健康检查响应
export interface HealthResponse {
  status: 'ok' | 'error';
  timestamp: number;
  service: string;
}

// Consul服务健康状态
export interface ConsulServiceHealth {
  service_id: string;
  service_name: string;
  status: 'passing' | 'warning' | 'critical';
  address: string;
  port: number;
  tags: string[];
}

// 应用信息
export interface AppInfo {
  name: string;
  version: string;
  author: string;
}

// 菜单项类型
export interface MenuItem {
  key: string;
  label: string;
  icon?: React.ReactNode;
  children?: MenuItem[];
  path?: string;
}

// 面包屑项
export interface BreadcrumbItem {
  title: string;
  path?: string;
}

// 侧边栏菜单状态
export interface SidebarState {
  collapsed: boolean;
  selectedKeys: string[];
  openKeys: string[];
}

// 主题配置
export interface ThemeConfig {
  primaryColor: string;
  borderRadius: number;
  wireframe: boolean;
}

// 用户设置
export interface UserSettings {
  theme: 'light' | 'dark';
  language: 'zh-CN' | 'en-US';
  sidebarCollapsed: boolean;
  autoRefresh: boolean;
  refreshInterval: number;
}

// 错误类型
export interface AppError {
  code: string;
  message: string;
  details?: any;
}

// 操作日志
export interface AuditLog {
  id: string;
  timestamp: string;
  operation: string;
  username: string;
  resource: string;
  details?: Record<string, any>;
  status: 'success' | 'failed';
}
